---
title: Iterative Workflow
description: Quality-driven processes requiring repetition until specific conditions are met
---

**Example Use-Cases**: Quality improvement loops, retry mechanisms, iterative refinement

Iterative workflows provide controlled repetition with deterministic exit conditions, ensuring consistent quality standards.

<img 
  className="block dark:hidden" 
  src="/images/workflows-loop-steps-light.png" 
  alt="Workflows loop steps diagram"
/>
<img 
  className="hidden dark:block" 
  src="/images/workflows-loop-steps.png" 
  alt="Workflows loop steps diagram"
/>

## Example

```python iterative_workflow.py
from agno.workflow import Loop, Step, Workflow

def quality_check(outputs) -> bool:
    # Return True to break loop, False to continue
    return any(len(output.content) > 500 for output in outputs)

workflow = Workflow(
    name="Quality-Driven Research",
    steps=[
        Loop(
            name="Research Loop",
            steps=[Step(name="Deep Research", agent=researcher)],
            end_condition=quality_check,
            max_iterations=3
        ),
        Step(name="Final Analysis", agent=analyst),
    ]
)

workflow.print_response("Research the impact of renewable energy on global markets", markdown=True)
```

## Developer Resources

- [Loop Steps Workflow](/examples/concepts/workflows/03_workflows_loop_execution/loop_steps_workflow)

## Reference

For complete API documentation, see [Loop Steps Reference](/reference/workflows/loop-steps).